home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 25 / CU Amiga Magazine's Super CD-ROM 25 (1998)(EMAP Images)(GB)(Track 1 of 2)[!][issue 1998-08].iso / CUCD / Programming / ixemul / sdk / man / cat4 / netintro.0 < prev    next >
Encoding:
Text File  |  1998-06-15  |  11.2 KB  |  228 lines

  1.  
  2. NETINTRO(4)                UNIX Programmer's Manual                NETINTRO(4)
  3.  
  4. NNAAMMEE
  5.      nneettwwoorrkkiinngg - introduction to networking facilities
  6.  
  7. SSYYNNOOPPSSIISS
  8.      ##iinncclluuddee <<ssyyss//ssoocckkeett..hh>>
  9.      ##iinncclluuddee <<nneett//rroouuttee..hh>>
  10.      ##iinncclluuddee <<nneett//iiff..hh>>
  11.  
  12. DDEESSCCRRIIPPTTIIOONN
  13.      This section is a general introduction to the networking facilities
  14.      available in the system.  Documentation in this part of section 4 is bro-
  15.      ken up into three areas: _p_r_o_t_o_c_o_l _f_a_m_i_l_i_e_s (domains), _p_r_o_t_o_c_o_l_s, and
  16.      _n_e_t_w_o_r_k _i_n_t_e_r_f_a_c_e_s.
  17.  
  18.      All network protocols are associated with a specific _p_r_o_t_o_c_o_l _f_a_m_i_l_y. A
  19.      protocol family provides basic services to the protocol implementation to
  20.      allow it to function within a specific network environment.  These ser-
  21.      vices may include packet fragmentation and reassembly, routing, address-
  22.      ing, and basic transport.  A protocol family may support multiple methods
  23.      of addressing, though the current protocol implementations do not.  A
  24.      protocol family is normally comprised of a number of protocols, one per
  25.      socket(2) type.  It is not required that a protocol family support all
  26.      socket types.  A protocol family may contain multiple protocols support-
  27.      ing the same socket abstraction.
  28.  
  29.      A protocol supports one of the socket abstractions detailed in socket(2).
  30.       A specific protocol may be accessed either by creating a socket of the
  31.      appropriate type and protocol family, or by requesting the protocol ex-
  32.      plicitly when creating a socket.  Protocols normally accept only one type
  33.      of address format, usually determined by the addressing structure inher-
  34.      ent in the design of the protocol family/network architecture.  Certain
  35.      semantics of the basic socket abstractions are protocol specific.  All
  36.      protocols are expected to support the basic model for their particular
  37.      socket type, but may, in addition, provide non-standard facilities or ex-
  38.      tensions to a mechanism.  For example, a protocol supporting the
  39.      SOCK_STREAM abstraction may allow more than one byte of out-of-band data
  40.      to be transmitted per out-of-band message.
  41.  
  42.      A network interface is similar to a device interface.  Network interfaces
  43.      comprise the lowest layer of the networking subsystem, interacting with
  44.      the actual transport hardware.  An interface may support one or more pro-
  45.      tocol families and/or address formats.  The SYNOPSIS section of each net-
  46.      work interface entry gives a sample specification of the related drivers
  47.      for use in providing a system description to the config(8) program.  The
  48.      DIAGNOSTICS section lists messages which may appear on the console and/or
  49.      in the system error log, _/_v_a_r_/_l_o_g_/_m_e_s_s_a_g_e_s (see syslogd(8)),  due to er-
  50.      rors in device operation.
  51.  
  52. PPRROOTTOOCCOOLLSS
  53.      The system currently supports the Internet protocols, the Xerox Network
  54.      Systems(tm) protocols, and some of the ISO OSI protocols.  Raw socket in-
  55.      terfaces are provided to the IP protocol layer of the Internet, and to
  56.      the IDP protocol of Xerox NS. Consult the appropriate manual pages in
  57.      this section for more information regarding the support for each protocol
  58.      family.
  59.  
  60. AADDDDRREESSSSIINNGG
  61.      Associated with each protocol family is an address format.  All network
  62.      address adhere to a general structure, called a sockaddr, described be-
  63.      low. However, each protocol imposes finer and more specific structure,
  64.      generally renaming the variant, which is discussed in the protocol family
  65.      manual page alluded to above.
  66.  
  67.                struct sockaddr {
  68.                    u_char  sa_len;
  69.                    u_char  sa_family;
  70.                    char    sa_data[14];
  71.            };
  72.  
  73.      The field _s_a___l_e_n contains the total length of the of the structure, which
  74.      may exceed 16 bytes.  The following address values for _s_a___f_a_m_i_l_y are
  75.      known to the system (and additional formats are defined for possible fu-
  76.      ture implementation):
  77.  
  78.      #define    AF_UNIX      1    /* local to host (pipes, portals) */
  79.      #define    AF_INET      2    /* internetwork: UDP, TCP, etc. */
  80.      #define    AF_NS        6    /* Xerox NS protocols */
  81.      #define    AF_CCITT     10   /* CCITT protocols, X.25 etc */
  82.      #define    AF_HYLINK    15   /* NSC Hyperchannel */
  83.      #define    AF_ISO       18   /* ISO protocols */
  84.  
  85. RROOUUTTIINNGG
  86.      UNIX provides some packet routing facilities.  The kernel maintains a
  87.      routing information database, which is used in selecting the appropriate
  88.      network interface when transmitting packets.
  89.  
  90.      A user process (or possibly multiple co-operating processes) maintains
  91.      this database by sending messages over a special kind of socket.  This
  92.      supplants fixed size ioctl(2) used in earlier releases.
  93.  
  94.      This facility is described in route(4).
  95.  
  96. IINNTTEERRFFAACCEESS
  97.      Each network interface in a system corresponds to a path through which
  98.      messages may be sent and received.  A network interface usually has a
  99.      hardware device associated with it, though certain interfaces such as the
  100.      loopback interface, lo(4),  do not.
  101.  
  102.      The following ioctl calls may be used to manipulate network interfaces.
  103.      The ioctl is made on a socket (typically of type SOCK_DGRAM) in the de-
  104.      sired domain.  Most of the requests supported in earlier releases take an
  105.      _i_f_r_e_q structure as its parameter.  This structure has the form
  106.  
  107.      struct  ifreq {
  108.      #define    IFNAMSIZ    16
  109.          char    ifr_name[IFNAMSIZE];        /* if name, e.g. "en0" */
  110.          union {
  111.              struct    sockaddr ifru_addr;
  112.              struct    sockaddr ifru_dstaddr;
  113.              struct    sockaddr ifru_broadaddr;
  114.              short     ifru_flags;
  115.              int       ifru_metric;
  116.              caddr_t   ifru_data;
  117.          } ifr_ifru;
  118.      #define ifr_addr      ifr_ifru.ifru_addr    /* address */
  119.      #define ifr_dstaddr   ifr_ifru.ifru_dstaddr /* other end of p-to-p link */
  120.      #define ifr_broadaddr ifr_ifru.ifru_broadaddr /* broadcast address */
  121.      #define ifr_flags     ifr_ifru.ifru_flags   /* flags */
  122.      #define ifr_metric    ifr_ifru.ifru_metric  /* metric */
  123.      #define ifr_data      ifr_ifru.ifru_data    /* for use by interface */
  124.      };
  125.  
  126.      Calls which are now deprecated are:
  127.  
  128.      SIOCSIFADDR     Set interface address for protocol family.  Following the
  129.                      address assignment, the ``initialization'' routine for
  130.  
  131.  
  132.                      the interface is called.
  133.  
  134.      SIOCSIFDSTADDR  Set point to point address for protocol family and inter-
  135.                      face.
  136.  
  137.      SIOCSIFBRDADDR  Set broadcast address for protocol family and interface.
  138.  
  139.      Ioctl requests to obtain addresses and requests both to set and retrieve
  140.      other data are still fully supported and use the _i_f_r_e_q structure:
  141.  
  142.      SIOCGIFADDR     Get interface address for protocol family.
  143.  
  144.      SIOCGIFDSTADDR  Get point to point address for protocol family and inter-
  145.                      face.
  146.  
  147.      SIOCGIFBRDADDR  Get broadcast address for protocol family and interface.
  148.  
  149.      SIOCSIFFLAGS    Set interface flags field.  If the interface is marked
  150.                      down, any processes currently routing packets through the
  151.                      interface are notified; some interfaces may be reset so
  152.                      that incoming packets are no longer received.  When
  153.                      marked up again, the interface is reinitialized.
  154.  
  155.      SIOCGIFFLAGS    Get interface flags.
  156.  
  157.      SIOCSIFMETRIC   Set interface routing metric.  The metric is used only by
  158.                      user-level routers.
  159.  
  160.      SIOCGIFMETRIC   Get interface metric.
  161.  
  162.      There are two requests that make use of a new structure:
  163.  
  164.      SIOCAIFADDR     An interface may have more than one address associated
  165.                      with it in some protocols.  This request provides a means
  166.                      to add additional addresses (or modify characteristics of
  167.                      the primary address if the default address for the ad-
  168.                      dress family is specified).  Rather than making separate
  169.                      calls to set destination or broadcast addresses, or net-
  170.                      work masks (now an integral feature of multiple proto-
  171.                      cols) a separate structure is used to specify all three
  172.                      facets simultaneously (see below).  One would use a
  173.                      slightly tailored version of this struct specific to each
  174.                      family (replacing each sockaddr by one of the family-spe-
  175.                      cific type).  Where the sockaddr itself is larger than
  176.                      the default size, one needs to modify the ioctl identifi-
  177.                      er itself to include the total size, as described in
  178.                      ioctl.
  179.  
  180.      SIOCDIFADDR     This requests deletes the specified address from the list
  181.                      associated with an interface.  It also uses the
  182.                      _i_f___a_l_i_a_s_r_e_q structure to allow for the possibility of
  183.                      protocols allowing multiple masks or destination address-
  184.                      es, and also adopts the convention that specification of
  185.                      the default address means to delete the first address for
  186.                      the interface belonging to the address family in which
  187.                      the original socket was opened.
  188.  
  189.      SIOCGIFCONF     Get interface configuration list.  This request takes an
  190.                      _i_f_c_o_n_f structure (see below) as a value-result parameter.
  191.                      The _i_f_c___l_e_n field should be initially set to the size of
  192.                      the buffer pointed to by _i_f_c___b_u_f. On return it will con-
  193.                      tain the length, in bytes, of the configuration list.
  194.  
  195.      /*
  196.      * Structure used in SIOCAIFCONF request.
  197.      */
  198.      struct ifaliasreq {
  199.              char    ifra_name[IFNAMSIZ];   /* if name, e.g. "en0" */
  200.              struct  sockaddr        ifra_addr;
  201.              struct  sockaddr        ifra_broadaddr;
  202.              struct  sockaddr        ifra_mask;
  203.      };
  204.  
  205.      /*
  206.      * Structure used in SIOCGIFCONF request.
  207.      * Used to retrieve interface configuration
  208.      * for machine (useful for programs which
  209.      * must know all networks accessible).
  210.      */
  211.      struct ifconf {
  212.          int   ifc_len;              /* size of associated buffer */
  213.          union {
  214.              caddr_t    ifcu_buf;
  215.              struct     ifreq *ifcu_req;
  216.          } ifc_ifcu;
  217.      #define ifc_buf ifc_ifcu.ifcu_buf /* buffer address */
  218.      #define ifc_req ifc_ifcu.ifcu_req /* array of structures returned */
  219.      };
  220.  
  221. SSEEEE AALLSSOO
  222.      socket(2),  ioctl(2),  intro(4),  config(8),  routed(8)
  223.  
  224. HHIISSTTOORRYY
  225.      The nneettiinnttrroo manual appeared in 4.3BSD-Tahoe.
  226.  
  227. 4.2 Berkeley Distribution      November 30, 1993                             4
  228.